﻿<controls:FloatableWindow x:Class="A_ManageUsers.BulkNewUserR"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=FloatableWindow"
           Width="400" Height="300" 
                      xmlns:dm="clr-namespace:DataModel;assembly=DataModel"
                      xmlns:drag="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows"
           Title="Bulk Add of New Users" HasCloseButton="False">
    <controls:FloatableWindow.Resources>
        <dm:SaveChangesCommand x:Key="SaveChanges" />
        <dm:CancelChangesCommand x:Key="CancelChanges" />
    </controls:FloatableWindow.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock>To Add New Users, type them into the box below, one user per line.</TextBlock>
            <TextBox Grid.Row="1" Margin="2" AcceptsReturn="True" x:Name="UsersBox"/>
            <ListBox Grid.Row="2" Grid.Column="1" Margin="2" x:Name="RolesList" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding Path=Enabled, Mode=TwoWay}" Content="{Binding Path=RoleName}"/>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>

        <Grid Grid.Row="1">
            <Grid x:Name="SaveG" Visibility="Collapsed">
                <CheckBox HorizontalAlignment="Left" Width="200" Click="CreateUsersToSave">
                    <TextBlock TextWrapping="Wrap" >I have made a record of these Passwords and selected Roles.</TextBlock>
                </CheckBox>
                <Button Command="{StaticResource CancelChanges}" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" />
                <Button x:Name="SaveChanges" IsEnabled="False" Command="{StaticResource SaveChanges}" Content="Save" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" />
            </Grid>

            <Grid x:Name="GeneratePasswordsG">
                <Button Command="{StaticResource CancelChanges}" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" />
                <Button Content="Generate Passwords" Click="GeneratePasswords" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" />
            </Grid>
        </Grid>
    </Grid>
</controls:FloatableWindow>